<?php


namespace app\index\controller;


use think\Controller;

class Common extends Controller
{
    public static function indexMenu()
    {
        $data = db("menu")->select();
        return $data;
    }
    public static function indexNav()
    {
        $data = db("nav")->select();
        return $data;
    }
    public static function indexGoods($type,$limit)
    {
        $data = db("goods")
            ->where('type',$type)
            ->join('goods_cate','goods.cate_id = goods_cate.cate_id')
//            ->field('name as cate_name')
            ->limit($limit)->select();
        return $data;
    }
    public static function indexGoodsCate($pid)
    {
        $data = db("goods_cate")->where("pid",$pid)->limit(5)->select();
        return $data;
    }
    public static function indexSetting()
    {
        $data = db("setting")->find();
        $data['about'] = explode('#',$data['footer_about']);
        $data['about_we'] = explode('#',$data['footer_about_we']);
        $data['phone'] = explode('#',$data['phone']);
        $data['address'] = explode('#',$data['address']);
        $data['job_info'] = explode('#',$data['job_info']);
        unset($data['index_menu']);
        unset($data['footer_about']);
        unset($data['footer_about_we']);
        return $data;
    }

    public static function aboutCopyDescr()
    {
        $data = db("copy_descr")->select();
        return $data;
    }
}